package form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class AddServiceForm extends ActionForm {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2143515608735527489L;
	private String repartitionHoraire = "";
	private String libelle = "";
	
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) 
	{
		ActionErrors errors = new ActionErrors ();
		
		if (repartitionHoraire == null || repartitionHoraire.length() == 0)
			errors.add("repartitionHoraire", new ActionMessage ("empty"));
		if (libelle == null || libelle.length() == 0)
			errors.add("libelle", new ActionMessage ("empty"));
		return errors;
	}
	
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		//              reset our field
		libelle = "";
		repartitionHoraire = "";
	}

	
	public String getLibelle() {
		return libelle;
	}
	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}
	public String getRepartitionHoraire() {
		return repartitionHoraire;
	}
	public void setRepartitionHoraire(String repartitionHoraire) {
		this.repartitionHoraire = repartitionHoraire;
	}

	
}
